package com.wh.controller.storehousemanage;

import com.wh.pojo.Remove;
import com.wh.service.storehousemanage.RemoveService;
import com.wh.vo.PageResult;
import com.wh.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@CrossOrigin
@RequestMapping("/remove/")
public class RemoveController {

    @Autowired
    private RemoveService removeService;

    @GetMapping("getQuery")
    public SysResult getQuery(Remove remove){
        Map<String,Object> map = removeService.getQuery(remove);
        return SysResult.success(map);
    }

    @PostMapping("addRemove")
    public SysResult addRemove(@RequestBody Remove remove){
        removeService.addRemove(remove);
        return SysResult.success();
    }

    @GetMapping("list")
    public SysResult getRemoveList(PageResult pageResult){
        pageResult = removeService.getRemoveList(pageResult);
        return SysResult.success(pageResult);
    }

    @PutMapping("updata")
    public SysResult updataRemove(@RequestBody Remove remove){
        removeService.updataRemove(remove);
        return SysResult.success();
    }
}
